﻿@for (var index = 0; index < 2; index++)
{
    @RenderRow(index)
}

@code {
    private string GetRowClassString(int index) => index == SelectedIndex ? "active" : null;

    private int SelectedIndex { get; set; }

    private void ClickRow(int index) => SelectedIndex = index;

    RenderFragment RenderRow(int index) =>
    @<tr class="@GetRowClassString(index)" @onclick="@(EventCallback.Factory.Create<MouseEventArgs>(this, () => ClickRow(index)))">
        <td>Cell1</td>
        <td>Cell1</td>
        <td>Cell1</td>
    </tr>;
}
